package hlhj.fhp.newslib

import android.graphics.Color
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.RelativeLayout
import com.tenma.ventures.base.TMActivity
import com.tenma.ventures.bean.utils.TMSharedPUtil
import hlhj.fhp.newslib.customview.LoadingDialog

abstract class BaseAty : TMActivity() {
    lateinit var loadingDialog:LoadingDialog
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getContentId())
        loadingDialog=LoadingDialog(this)
        initView()
        initListener()
        val loBack = findViewById<ViewGroup>(R.id.loBack)
        if (null!=loBack){
            Log.e("infoo","判断颜色${this.packageName}")
            if (null!= TMSharedPUtil.getTMThemeColor(this)&& TMSharedPUtil.getTMThemeColor(this).length>0){
                Log.e("infoo","判断颜色${this.packageName}")
                loBack.setBackgroundColor(Color.parseColor(TMSharedPUtil.getTMThemeColor(this)))
            }
        }
        val btExit = findViewById<ImageView>(R.id.btExit)
        if (null!=btExit){
            btExit.setOnClickListener {
                finish()
            }
        }
    }

    abstract fun initListener()

    abstract fun initView()

    abstract fun getContentId():Int


}
